package com.gym.baselib.utils

import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
import io.reactivex.rxjava3.core.Observable
import io.reactivex.rxjava3.core.ObservableSource
import io.reactivex.rxjava3.core.ObservableTransformer
import io.reactivex.rxjava3.schedulers.Schedulers

/**
 *创建人：东
 *时间：2021/1/27
 */
object RxRunThread {
    fun <UD> rxud(): ObservableTransformer<UD, UD> {
        return object : ObservableTransformer<UD,UD>{
            override fun apply(upstream: Observable<UD>): ObservableSource<UD> {
                return upstream.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
            }
        }
    }
}